<template>
  <div>
    <!-- $emit  ：  发生时间 -->
    <button @click="$emit('abc', 1234)">Click Me</button>
    {{ text }}
    <button @click="btnok">Click Me ---- 》 Ok</button>
    <input v-model="name" />
  </div>
</template>

<script setup>
import { ref } from "vue";

const props = defineProps({
  text: {
    type: String,
    require: true,
    default: "abc",
  },
});

// 定义对外暴露的事件名
const emits = defineEmits(["abc", "ok", "gameover"]);
const name = ref("");

const btnok = () => {
  emits("ok", name.value);
  // $emit("abc", name.value);
};
</script>
